package com.bank.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@ApiModel(description = "账户存取款，转账操作传递的数据")
public class AccountOperationDTO {
    @NotNull(message = "账户ID不能为空")
    @ApiModelProperty("账户ID")
    private Long accountId;

    @NotNull(message = "操作金额不能为空")
    @DecimalMin(value = "-100000.00", message = "金额必须小于100000.00元")
    @DecimalMax(value = "100000.00", message = "金额必须小于100000.00元")
    @ApiModelProperty("操作金额，负数表示取款，正数表示存款")
    private BigDecimal amount;

    @Pattern(regexp = "\\d{6}", message = "密码必须为6位数字")
    @ApiModelProperty("支付密码")
    private String password;

    @NotBlank(message = "备注不能为空")
    @ApiModelProperty("备注")
    private String remark;

//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("操作时间")
    private LocalDateTime operationTime;

    @ApiModelProperty("相关账户ID，用于转账操作，没有则表示存取款操作")
    private Long relatedAccount;
}
